package com.chat.system.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * <p>
 * 
 * </p>
 *
 * @author czh
 * @since 2023-10-28
 */
@Getter
@Setter
@TableName("chat_user_application")
@NoArgsConstructor
public class ChatUserApplication implements Serializable {

    public static final String NOT_DONE = "0";
    public static final String ACCEPT = "1";
    public static final String REFUSE = "2";

    private static final long serialVersionUID = 1L;

    public ChatUserApplication(String id) {
        this.id = id;
    }

    @TableId(value = "id",type = IdType.ASSIGN_UUID)
    private String id;

    @TableField("_from")
    private String from;

    @TableField("_to")
    private String to;

    public ChatUserApplication(String from, String to) {
        this.from = from;
        this.to = to;
        status = NOT_DONE;
    }

    /**
     * 0:未答复1:接受2：拒绝
     */
    @TableField("status")
    private String status;

    public void accept(){
        status = ACCEPT;
    }
    private void refuse() {
        status = REFUSE;
    }

}
